<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>事件委托</title>
  </head>
  <body>
    <ul id="u1">
      <li><a href="javascript:;" name="link">超链接1</a></li>
      <li><a href="javascript:;" name="link">超链接2</a></li>
      <li><a href="javascript:;" name="link">超链接3</a></li>
    </ul>

    <script>
      var u1 = document.getElementById("u1");
      u1.onclick = function (event) {
        event = event || window.event;
        var name = event.target.name;
        if (name === "link") {
          alert(event.target.innerHTML);
        }
      };
    </script>
  </body>
</html>
